<template>
  <div class="quotes-container">
    <div class="quotes-content" ref="quotesChart">
      <div class="quote-card" v-if="currentQuote">
        <div class="quote-text">{{ currentQuote.text }}</div>
        <div class="quote-info">
          <span class="poet-name">{{ currentQuote.poet }}</span>
          <span class="poem-title">《{{ currentQuote.title }}》</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'PoetryQuotes',
  data() {
    return {
      currentQuote: null,
      quotesList: [
        {
          text: '长风破浪会有时，直挂云帆济沧海。',
          poet: '李白',
          title: '行路难'
        },
        {
          text: '安能摧眉折腰事权贵，使我不得开心颜。',
          poet: '李白',
          title: '梦游天姥吟留别'
        },
        {
          text: '无边落木萧萧下，不尽长江滚滚来。',
          poet: '杜甫',
          title: '登高'
        },
        {
          text: '国破山河在，城春草木深。',
          poet: '杜甫',
          title: '春望'
        },
        {
          text: '东风夜放花千树，更吹落、星如雨。',
          poet: '辛弃疾',
          title: '青玉案·元夕'
        },
        {
          text: '水光潋滟晴方好，山色空蒙雨亦奇。',
          poet: '苏轼',
          title: '饮湖上初晴后雨'
        }
      ]
    }
  },
  mounted() {
    this.startQuoteRotation()
  },
  beforeDestroy() {
    if (this.rotationTimer) {
      clearInterval(this.rotationTimer)
    }
  },
  methods: {
    startQuoteRotation() {
      this.showRandomQuote()
      this.rotationTimer = setInterval(() => {
        this.showRandomQuote()
      }, 5000)
    },
    showRandomQuote() {
      const randomIndex = Math.floor(Math.random() * this.quotesList.length)
      this.currentQuote = this.quotesList[randomIndex]
    }
  }
}
</script>

<style scoped>
.quotes-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: rgba(255, 123, 0, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  overflow: hidden;
}

.quotes-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.quote-card {
  width: 100%;
  text-align: center;
  animation: fadeIn 1s ease;
}

.quote-text {
  font-size: 24px;
  color: #ff7b00;
  font-family: '楷体', serif;
  margin-bottom: 20px;
  line-height: 1.5;
  text-shadow: 0 0 10px rgba(255, 123, 0, 0.2);
}

.quote-info {
  font-size: 16px;
  color: #ff9e45;
}

.poet-name {
  margin-right: 10px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

:deep(.el-radio-button__inner) {
  background-color: transparent;
  border-color: #ff7b00;
  color: #ff7b00;
}

:deep(.el-radio-button__orig-radio:checked + .el-radio-button__inner) {
  background-color: #ff7b00;
  border-color: #ff7b00;
  box-shadow: -1px 0 0 0 #ff7b00;
}
</style> 